<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>一个重要的内置关系</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <!-- 
        VueComponents.prototype === object.__proto__ 原本
        改变了指向
        VueComponents.prototype.__proto__ === Vue.prototype
        验证 在vm上添加x= 99
        在VueComponents身上验证
     -->
    <div id="root">
        <school></school>
    </div>
    
</body>
<script type="text/javascript">
    Vue.config.productionTip = false //以阻止 vue 在启动时生成生产提示。
    Vue.prototype.x = 99
    const school = Vue.extend({
        template:`
            <div class="box">
                <button @click='show'>按钮</button>
            </div>
        `,
        methods:{
            show(){
                alert(this.x)
            }
        },
    })
    //创建Vue
    const vm = new Vue({
        el:'#root', 
        components:{school}
    })
    /* function Demo(){
        this.a = 1
        this.b = 2
    }
    const d = new Demo()
    d.__proto__.x = 'fsa'
    console.log(Demo.prototype === d.__proto__); */
</script>
</html>